package com.draven.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.draven.common.entity.NoteTagRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 笔记标签关联Mapper接口
 * 
 * @author draven
 */
@Mapper
public interface NoteTagRelationMapper extends BaseMapper<NoteTagRelation> {

    /**
     * 根据笔记ID删除关联关系
     * 
     * @param noteId 笔记ID
     * @return 影响行数
     */
    @Delete("UPDATE note_tag_relation SET del_flag = 1 WHERE note_id = #{noteId}")
    int deleteByNoteId(@Param("noteId") Long noteId);

    /**
     * 根据标签ID删除关联关系
     * 
     * @param tagId 标签ID
     * @return 影响行数
     */
    @Delete("UPDATE note_tag_relation SET del_flag = 1 WHERE tag_id = #{tagId}")
    int deleteByTagId(@Param("tagId") Long tagId);
}